package com.niodata.dp.app;

import com.niodata.dp.log.LogUtil;
import com.niodata.dp.util.JsonUtil;
import java.io.IOException;
import org.apache.log4j.Logger;

public abstract class AbstractVariableValue implements VariableValue {

  private static final Logger logger = Logger.getLogger(AbstractVariableValue.class);

  protected VariableType variableType;

  @Override
  public String toString() {
    try {
      return JsonUtil.toJson(this);
    } catch (IOException e) {
      LogUtil.logStackTrace(logger, e);
    }
    return "";
  }

  @Override
  public VariableType getVariableType() {
    return variableType;
  }

  public void setVariableType(VariableType variableType) {
    this.variableType = variableType;
  }
}
